package com.example.workbook.controller;

import com.example.workbook.common.R;
import com.example.workbook.model.request.ContentRequest;
import com.example.workbook.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/content")
public class ContentController {
    @Autowired
    private ContentService contentService;

    /**
     * 添加内容
     * @param contentRequest
     * @return
     */
    @PostMapping("/add")
    public R addContent(@RequestBody ContentRequest contentRequest) {
        return contentService.addContent(contentRequest);
    }
    /**
     * 修改完成内容时间
     * @param
     * @return
     */
    @PostMapping("/updateEndTime")
    public R updateContentEndTime(@RequestBody ContentRequest contentRequest) {
        return contentService.updateContentEndTime(contentRequest);
    }
    /**
     * 获得指定用户 ID 的工作内容
     * @param userId
     * @return
     */
    @GetMapping("/detail")
    public R contentOfUserId(@RequestParam Integer userId) {
        return contentService.contentOfUserId(userId);
    }
}
